package cn.uai.activiti8.approval.config;

import com.github.yitter.idgen.DefaultIdGenerator;
import com.github.yitter.idgen.YitIdHelper;
import org.activiti.api.runtime.shared.identity.UserGroupManager;
import org.activiti.engine.impl.cfg.IdGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * @desc
 * @author uai
 * @since 2025/8/7 23:19
 * @version 1.0
 */
@Configuration
public class ActivitiConfig {

    /**
     * 添加 UserGroupManager 的空实现，帮助SpringBoot启动时创建 ProcessEngineAutoConfiguration
     * @return
     */
    @Bean
    public UserGroupManager userGroupManager() {
        return new UserGroupManager() {
            @Override
            public List<String> getUserGroups(String username) {
                return List.of();
            }

            @Override
            public List<String> getUserRoles(String username) {
                return List.of();
            }

            @Override
            public List<String> getGroups() {
                return List.of();
            }

            @Override
            public List<String> getUsers() {
                return List.of();
            }
        };
    }

//    @Bean
//    public IdGenerator idGenerator() {
//        return () -> Long.toString(YitIdHelper.nextId());
//    }
}
